package com.wondertek.poms.dao.repo;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.wondertek.poms.dao.po.MediaFile;

@Repository
public interface IMediaFileDao extends JpaRepository<MediaFile,Long> {

    void deleteByContentId(String contentId);

    List<MediaFile> findAllByContentId(String contentId);

    List<MediaFile> findAllByContentIdAndOprCode(String contentId,String oprCode);

    List<MediaFile> findAllByContentIdAndMediaFileID(String contentId,String mediaFileId);

    @Query(value="select * from MEDIA_FILE where CONTENT_ID=?1 and (OPR_CODE = '0' or (MEDIA_FILE_ACTION = '2' and OPR_CODE = '2'))",nativeQuery=true)
    List<MediaFile> findList(String contentId);
}
